var http = require('http');
var cunto = 80
var ip = "127.0.0.1"
var server = http.createServer(function (request, response) {
	
	// 发送 HTTP 头部 
	// HTTP 状态值: 200 : OK
	// 内容类型: text/plain
	// for (var i = 0; i < response.headers.length; i++) {
	// 	response.headers[i]
	// 	console.log(i)
	// }

	console.log(request.url)
	// response.statusCode = 200;
	response.statusMessage = "zhaobudao"
	response.setHeader("Content-Type","text/html")
	response.setHeader("x-Foo","bar")
		var s = "<html>"
			s += "<head></head>" 
			s += "<body>Hello World</body>"
			s += "</html>"
	// 发送响应数据 "Hello World"
	response.end(s);
})
 server.listen(80);

// 终端打印如下信息
console.log('Server running at http://%s:%s/',ip,cunto);